home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / share / doc / Xpm / FAQ.z / FAQ
Encoding:
Text File  |  1996-09-20  |  11.0 KB  |  263 lines

  1. /*
  2.  * Copyright (C) 1989-95 GROUPE BULL
  3.  *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  5.  * of this software and associated documentation files (the "Software"), to
  6.  * deal in the Software without restriction, including without limitation the
  7.  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8.  * sell copies of the Software, and to permit persons to whom the Software is
  9.  * furnished to do so, subject to the following conditions:
  10.  *
  11.  * The above copyright notice and this permission notice shall be included in
  12.  * all copies or substantial portions of the Software.
  13.  *
  14.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17.  * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  18.  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19.  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20.  *
  21.  * Except as contained in this notice, the name of GROUPE BULL shall not be
  22.  * used in advertising or otherwise to promote the sale, use or other dealings
  23.  * in this Software without prior written authorization from GROUPE BULL.
  24.  */
  25.  
  26.                 The XPM
  27.             Frequently Asked Questions
  28.  
  29. This article contains the answers to some Frequently Asked Questions about the
  30. XPM format and/or library. If you don't find the answer to your problem here,
  31. then you can mail either to lehors@sophia.inria.fr or to the mailing list
  32. xpm-talk@sophia.inria.fr.
  33.  
  34.                                Contents
  35.  
  36. 1. How do I convert my images to or from XPM ?
  37. 2. Why are my XPM files said to be invalid ?
  38. 3. Why does my program core dumps using XPM ?
  39. 4. Why does my program core dumps using XPM with a widget ?
  40. 5. How can I get a non rectangular icon using XPM ?
  41. 6. What exactly triggers the creation of a mask when using XPM ?
  42. 7. How should I use the mask ?
  43. 8. Is there a string to pixmap converter somewhere ?
  44. 9. How can I edit XPM icons ?
  45. 10. Is there a collection of icons somewhere ?
  46.  
  47. ----------------------------------------------------------------------
  48. 1. How do I convert my images to or from XPM ?
  49. ----------------------------------------------------------------------
  50.  
  51.   Netpbm is surely the best image conversion package that I know of. It defines
  52.   formats for color, gray and monochrom images and provides a set of filters.
  53.   Thus a GIF image can be converted to XPM with something like:
  54.  
  55.   $ giftoppm youricon.gif | ppmtoxpm > youricon.xpm
  56.  
  57.   The latest release can be found at least from wuarchive.wustl.edu
  58.   (128.252.135.4), directory /graphics/graphics/packages/NetPBM
  59.  
  60. ----------------------------------------------------------------------
  61. 2. Why are my XPM files said to be invalid ?
  62. ----------------------------------------------------------------------
  63.  
  64.   There are three official versions of the XPM format. The XPM library since
  65.   version 3.3 can read all them but writes out only XPM 3. Also the small
  66.   program called sxpm which is part of the XPM library package can be used to
  67.   automatically translate XPM 1 and 2 files to XPM 3 with a command such as:
  68.  
  69.   $ sxpm -nod yourxpm1or2file -o yourxpm3file
  70.  
  71.   Also, the XPM format defines "None" to be the color name meaning
  72.   "transparent", but IXI used to hack the XPM library in its early days to
  73.   handle transparency as "#Transparent". This makes IXI format not compatible
  74.   with the official XPM format, and so not readable neither by the official XPM
  75.   library nor any of the programs built on top of it.
  76.  
  77.   The only solutions are either to stick on IXI programs which can deal with
  78.   their format or convert your files to the standard XPM format. This can be
  79.   done simply by changing "#Transparent" to "None".
  80.  
  81. ----------------------------------------------------------------------
  82. 3. Why does my program core dumps using XPM ?
  83. ----------------------------------------------------------------------
  84.  
  85.   Be sure the XpmAttributes structure you pass by reference has a valid
  86.   valuemask. You can give NULL instead if you don't want to use an
  87.   XpmAttributes but if you do, you MUST initialize its valuemask component to
  88.   some valid value, at least 0, otherwise unpredictable errors can occur.
  89.  
  90.   So instead of doing something like:
  91.  
  92.       XpmAttributes attrib;
  93.  
  94.       XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib);
  95.  
  96.   you should do:
  97.  
  98.       XpmAttributes attrib;
  99.  
  100.       attrib.valuemask = 0;
  101.       XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib);
  102.  
  103. ----------------------------------------------------------------------
  104. 4. Why does my program core dumps using XPM with a widget ?
  105. ----------------------------------------------------------------------
  106.  
  107.   o First the XPM library is Xlib level, so don't pass your widget as a
  108.     Drawable parameter. A Drawable is either a Window or a Pixmap. The widget's
  109.     window can do the job but:
  110.  
  111.   o Then a widget only gets a Window when realized, so passing XtWindow(widget)
  112.     with a not yet realized widget is wrong. Either realize you widget first or
  113.     use another window. Since the Drawable parameter is only used to specify
  114.     the screen to which the pixmap must be created on, most of the time the
  115.     default root window is just fine.
  116.  
  117. ----------------------------------------------------------------------
  118. 5. How can I get a non rectangular icon using XPM ?
  119. ----------------------------------------------------------------------
  120.  
  121.   The X Window System does not support transparent color. However there are
  122.   several ways you can use to get the same visual effect using XPM:
  123.  
  124.   o First you can use the None color to get a shape mask and use it as
  125.     explained below (question 7).
  126.  
  127.   o Second you can define a symbolic color name such as "mask" in the XPM
  128.     format file, then use the color overriding mechanism to set this symbolic
  129.     color to the color of the underlying object. Note that in this case the XPM
  130.     library won't create a shape mask, and that if the color of the underlying
  131.     object is changed then you'll have to create a new pixmap.
  132.  
  133. ----------------------------------------------------------------------
  134. 6. What exactly triggers the creation of a mask when using XPM ?
  135. ----------------------------------------------------------------------
  136.  
  137.   Basically a mask is created if "None" is used as one of the color of the
  138.   pixmap. Be aware that this is not only true if it is used in the XPM of the
  139.   pixmap since the colors can be overriden at load time. So a mask is created
  140.   if the "None" color is used at load time, coming either from the XPM
  141.   definition or the color overriding.
  142.  
  143. ----------------------------------------------------------------------
  144. 7. How should I use the mask ?
  145. ----------------------------------------------------------------------
  146.  
  147.   There are basically two ways of using the mask:
  148.  
  149.   o Use the mask as a shapemask with the X11 Nonrectangular Saphe Window
  150.     Extension. Typically this is what should be done when the icon is used in a
  151.     desktop.
  152.  
  153.   o Use the mask as a clipmask in the GC you pass to XCopyArea when drawing the
  154.     pixmap. So the "transparent" pixels being not actually drawn will get the
  155.     underlying pixels colors.
  156.  
  157. ----------------------------------------------------------------------
  158. 8. Is there a string to pixmap converter for Motif ?
  159. ----------------------------------------------------------------------
  160.  
  161.   Not yet, but Motif 2.0 will support XPM pixmap as well as XBM bitmaps.
  162.  
  163. ----------------------------------------------------------------------
  164. 9. How can I edit XPM icons ?
  165. ----------------------------------------------------------------------
  166.  
  167.   As listed below several editors either commercial or not are supporting the
  168.   XPM format. However, pixmap is the one I would recommend since it is freely
  169.   available and, being fully dedicated to XPM, it allows to edit all the
  170.   special things, such as the symbolic color names, which makes XPM different
  171.   from all the other image formats. Pixmap can always be found by ftp from
  172.   ftp.x.org (contrib) and avahi.inria.fr (pub/pixmap).
  173.  
  174. Last Update: 3 August 1994
  175.  
  176.                 XPM Icon Editors
  177.                 ================
  178.  
  179. Program        Source/Author        Platforms    SA    XPM     cost
  180. ----------------------------------------------------------------------------
  181. pixmap        Lionel Mallet        source        yes     3     NC
  182.    * ftp.x.org:/contrib/application/pixmap/pixmap2.6.tar.gz
  183.    * requires 3.4 or higher revision of Xpm lib.
  184.    * supports all XPM format features
  185.    * current version doesn't work on 24-plane displays
  186.  
  187. pixt        J. Michael Flanery     source        yes     1     NC
  188.    * ftp.x.org:/contrib/pixt.tar.Z
  189.    * doesn't work on 24-plane displays
  190.    * last updated November 1991
  191.  
  192. pixed        IXI            Many UNIX    no     3    N/A
  193.    * part of X.desktop
  194.    * current version doesn't work on 24-plane displays
  195.  
  196. olpixmap    USL            Sun         no     1    N/A
  197.                     SVR4.2, UnixWare
  198.    * packaged with the OLIT (OpenLook) toolkit
  199.  
  200. xfedor        Daniel Dardailler    source        yes     3     NC
  201.    * only uses XLIB
  202.    * doesn't work on 24-plane displays
  203.  
  204. SCOpaint    SCO/Wing Eng        ODT        yes    2.8    N/A
  205.    * included with the ODT package
  206.  
  207. pme.icn        Icon Project        source        yes     3     NC
  208.    * written in the Icon language
  209.  
  210. PixEditT    Free Widget Foundation    source        yes     3     NC
  211.    * there is currently no support for editing the colormap
  212.  
  213. xscribble    Robert Forsman        source        yes     ?     NC
  214.    * requires the FWF, 8-bit pseudocolor
  215.    * ftp.cis.ufl.edu:/pub/thoth
  216.    * Alpha version (last updated April 1993)
  217.  
  218. vueicon        Hewlett-Packard        HP        yes     3    N/A
  219.    * included with Vue3.0
  220.  
  221. iconedit V3    SunSoft         Sparc/Sun3    yes     2    N/A
  222.  
  223. Pixmap Editor    ICS            ?        yes     ?     ?
  224.    * this is a Widget, not a complete program
  225.  
  226. ezX        Sunrise Software    ?        ?     ?    N/A
  227.  
  228. XPaint        David Koblas        source        yes     3     NC
  229.      * full featured, works on all displays
  230.      * current release is 2.1.1 (last update January 1994)
  231.  
  232. Phoenix        ohtcolor@niksula.hut.fi    source        yes     3     NC
  233.     * full featured, 24-bit painting program, requires Motif.
  234.     * nic.funet.fi:/pub/graphics/packages/phoenix/
  235.     * Beta version (last updated September 1993)
  236.  
  237. pixed           Alsys                   Many UNIX       yes      3       N/A
  238.     * pixed is part of the TeleUSE UIMS
  239.     * More info is available from service@ignite.alsys.com
  240.  
  241. display          John Cristy             source         yes      3       NC
  242.    * ftp.x.org:/contrib/application/ImageMagick/ImageMagick-3.2.tar.gz
  243.    * lots of image conversion and manipulation features
  244.  
  245. SA - Stand Alone program
  246. NC - No Charge (i.e. free); most programs are copyrighted.
  247. XPM - XPM format supported
  248. source - built from source code; likely works on all standard X platforms
  249. N/A - icon editor is normally distributed with other software
  250.  
  251.  
  252. Send updates, additions, corrections, etc. to 
  253.    dan@bristol.com
  254.  
  255. ----------------------------------------------------------------------
  256. 10. Is there a collection of icons somewhere ?
  257. ----------------------------------------------------------------------
  258.  
  259.   At least there is one freely available: Anthony's X Icon Library. You can
  260.   found it on several ftp servers. It contains only small icons (less than
  261.   about 100x100 pixels in size) which are stored in groups in a logical
  262.   way. Color icons are stored in XPM format and Black & White icons in XBM.
  263.